package com.smart.model.base;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 用户与前端交互的实体
 * @author zhuyong
 *
 */
public class JsonModel implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 请求的参数部分
	 */
	private Map<String, Object> header = new HashMap<String, Object>();
	/**
	 * 请求的内容部分
	 */
	private Map<String, Object> body = new HashMap<String, Object>();

	
	public void setBodyValue (String bodyKey,Object bodyValue){
		body.put(bodyKey, bodyValue);
	}
	
	public void setHeaderValue(String headerKey,String headerValue){
		header.put(headerKey, headerValue);
	}
	
	public String getBodyValue(String bodyKey){
		  if(body.containsKey(bodyKey)){
			   if(body.get(bodyKey)!=null){
				   return body.get(bodyKey).toString();
			   }else{
				   return "";
			   }
		  }else{
			  return "";
		  }
	}
	
	public String getHeaderValue(String HeaderKey){
		  if(header.containsKey(HeaderKey)){
			   return header.get(HeaderKey).toString();
		  }else{
			  return "";
		  }
	}

	public Map<String, Object> getHeader() {
		return header;
	}

	public void setHeader(Map<String, Object> header) {
		this.header = header;
	}

	public Map<String, Object> getBody() {
		return body;
	}

	public void setBody(Map<String, Object> body) {
		this.body = body;
	}
	
}
